package net.xdclass.config;

import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;

/**
 * @author : zhen.xue
 * @date : 2021-07-01 22:48
 */
public class AlipayConfig {


    /**
     * 支付宝网关地址
     */
    public static final String PAY_GATEWAY  = "https://openapi.alipaydev.com/gateway.do";

    /**
     * appID
     *
     */
    public static final String APPID = "2021000117682305";

    /**
     * 应用私钥
     */
    public static final String APP_PRI_KEY = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCN/gXkupXzomFgw0F5IQ3Rq6s2n9xozQyZ8r6nJhUgefjI98Wlg0WXJJI35KfpwQjxyfm/D/bDvv0IufJQIf6hlzoJrXI8sQwJ/f5AZZIcXjQpI+inPrdowrI6pmd+RDayx1l16pvYH/rk4QTrRxwqwPHe+Nxg1wgHtrq0HBbRMTfw/7gjuHjfcplk3Yz8cfu2EXkl8Dmg9h3JvDrMHDPnYOGyHY9U7Y+NssthkDuGYWB8tMMV16YvSpsqP0UNhZ9Xu809vskuMmynBDPhIBo9fmPMwTU3tAF9Cqrch7LOrhQCheWYbqK9Sta/rza/Vx6ykdyaLC8xsGul7Ej3Nia5AgMBAAECggEAR3ely7xGITyHusZMPAVxCSlYocPQkkcyooHViBfY5mG94JklN+tcqXhUyCEkirkIIXrBY3NLhraocS32UnLp0LdnFNvh9b4/CwB2aj81TWX05wgV36fndKkaP/7ldF4tEcrYsksFacCe7Xh8m1dNTA+VLd8gPPW+KvPEAUdqDJvuw1TBBChwoQn7HnP2bjC/DYcaLQXJRw1BSt8/p8hla2NYtbVkefvG744sof9cK3/L21w1m3yn4iGm04Asm7zkpPtBeI60q2vPpmvBKDZ0opJk/Hrt/caa5umAFhV5lgbyz8e6RcyV0RwZej/51AIBzNJnZy3MZ/gvTvU7pQ6ZyQKBgQDtI8vKG1n8lrxf1W/7wzH7tqNTi6yuKl5/zBRc4XGlXFZFsv+0mdSnXexs7LqZhXdcH8/dQYmo4tG1vLnFG3M86UyKleULKqnme6cugHam4GGL9+kn7Veeq+JfbVpORfQ9hXMWtRBD1Xnvrp2NZbBuGjX8mmHdF3nO2KUx88mrtwKBgQCZSQIKTmRQx9h650XLMjWjKP8LapzG47S3vYv4X4tlNd4jiijXpZkEKXblbpw/ZyABsx3qyHmcRCf9ToxAOsOT4nXahZPCvzfpUghaa+MbeL+3UnZG3uI9fbGjhftuSR0bvau2XhOq5v54SQtr0nk+YTleUXzG/5bGeAcyn9GhDwKBgCjsmojAe6EZqlynivHZ19Bmznzmh+Bus2w+ne0BgwlUjBbvMy3JtmdD0D9kAzfnTpf5bXfzjXw12JcSgMTBXfvPD0SDZcmtjTCXelyOEuvtoSf0mqonTY22gBST3JfRfrr3QstSaAIs3yQ78Disqev2Xga/5c+v83d879VVCyK1AoGBAJBxF5cWn7jvWLMX09DSE3EYZJ0hbXKNh/HMj2UQw44v4I+k1S/AQByH5h30yQ+F4cc4PezL1KzIHNa5ebfcqAdm0p+EV+Sfw9P9FRn/qBZvBll9Py8xQAeptgbdbjxScTd+15wVsnrNCOXYDwcfYljBzQlvyCDNIAsNd9rgdu1JAoGAN3bQhO3Adnd1MWJ4JSAsxJaEHn6GsSnWaglk9CMvUT6x+7HIorINTQO5vXY5ya6qbIWMPDL+QrZLf3zWjvkDX/sahhOnWUXhiDm+Qrg6VE8Dy+kq/qCkk6PP4byv3M7/bqs5u6rl4DOiUybRxfE18fLBxAx0avK2ACJK+k/Gub0=";

    /**
     * 应用公钥
     */
    public static final String ALPAY_PUB_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5okZjmQ8IRSBYCr3ItVu0z92gkTfQlFza6x1uiUw71w354q8ZHP2KNTCdleaO+w5S6kkXk79aLMr2UTespUaJLDlRrN+PrW2TgrcRMG1lZVrQHwx57P0dnIL15kLVnAmq0QrTycbA1IK+Sm88S2fhNUhpOYg4SbxwobJUsajHswR0lf8lswu6Z7aOKifHPcfX+1fBHSAQapXmtIsu1Xt6q/G2Ul6nFn9+bMAuxe2IoaaOMQ5BzF1zivcWLbrKwSzl/r2BSDD8SZVPrJaAQSlAsdDXi6lbYybfURBPZNBUdp2qOWOMcB3VDdqNpqTbH3+VGJQ/dyBnnI0UY0V4sau0wIDAQAB";

    /**
     * 签名类型
     */
    public static final String SING_TYPE = "RSA2";

    /**
     * 字符编码
     */
    public static final String CHARSET = "UTF-8";

    /**
     * 返回参数格式
     */
    public static final String FORMAT = "json";


    private AlipayConfig() {
    }

    private volatile static AlipayClient instance = null;

    /**
     * 单例模式获取
     * @return
     */
    public static AlipayClient getInstance(){
        if(instance == null){
            synchronized (AlipayClient.class){
                if (instance == null) {
                    instance = new DefaultAlipayClient(PAY_GATEWAY,APPID,APP_PRI_KEY,FORMAT,CHARSET,ALPAY_PUB_KEY,SING_TYPE);
                }
            }
        }
        return instance;
    }
}